from sympy import symbols, diff, sin, cos, cot, csc

t, a, b = symbols('t a b')
x_ellipse = a * cos(t)
y_ellipse = b * sin(t)

# 一阶导数
dx_dt = diff(x_ellipse, t)
dy_dt = diff(y_ellipse, t)
dy_dx = dy_dt / dx_dt

# 二阶导数
d2y_dx2 = diff(dy_dx, t) / dx_dt

print("椭圆参数方程的高阶导数:")
print(f"x = {x_ellipse}, y = {y_ellipse}")
print(f"一阶导数 dy/dx = {dy_dx.simplify()}")
print(f"二阶导数 d²y/dx² = {d2y_dx2.simplify()}")